<?php
  echo '<div id="outer-collection">
  			<div class="error" >'.$this->validation->error_string.'</div>';     
	
				  
	$attributes = array('class' => 'edit_user', 'id' => 'edit_user');
	
	echo form_open('admin/EditUser/'.$this->uri->segment(3), $attributes);

	
	
	$user_group =$user['MGroup'];
	switch($user_group)
	{
      case dohash(5): $group ='<option value="69">Subscriber</option>
              <option value="34">Author</option>
              <option value="5" selected="selected">Admin</option>';
              break;
      case dohash(34): $group ='<option value="69">Subscriber</option>
              <option value="34" selected="selected">Author</option>
              <option value="5" >Admin</option>';
              break;
      case dohash(69): $group ='<option value="69" selected="selected">Subscriber</option>
              <option value="34">Author</option>
              <option value="5" >Admin</option>';
              break;                
       default: $group ='<option value="69" selected="selected">Subscriber</option>
              <option value="34">Author</option>
              <option value="5" >Admin</option>';
              break;
              
      }       
	
	$username = array(
				  'name'        => 'username',
				  'id'          => 'username',
				  'value'       => $user['MName'],
				  'readonly'=>'readonly',
				  'maxlength'   => '100',
				  'size'        => '50',
				  'class'       => 'input',
				);
				 
	$password = array(
				  'name'        => 'password',
				  'id'          => 'password',
				  'value'       => '',
				  'maxlength'   => '100',
				  'size'        => '50',
				  'class'       => 'input',
				);	
				
	
	$email = array(
				  'name'        => 'email',
				  'id'          => 'email',
				  'value'       => $user['MEmail'],
				  'maxlength'   => '100',
				  'size'        => '50',
				  'class'       => 'input',
				);
				
	$murl = array(
				  'name'        => 'murl',
				  'id'          => 'murl',
				  'value'       => $user['MUrl'],
				  'maxlength'   => '100',
				  'size'        => '50',
				  'class'       => 'input',
				);			
				
	$firstname = array(
				  'name'        => 'firstname',
				  'id'          => 'firstname',
				  'value'       => $user['MFirstName'],
				  'maxlength'   => '100',
				  'size'        => '50',
				  'class'       => 'input',
				);
				
	$lastname = array(
				  'name'        => 'lastname',
				  'id'          => 'lastname',
				  'value'       => $user['MLastName'],
				  'maxlength'   => '100',
				  'size'        => '50',
				  'class'       => 'input',
				);												
	
	
	$tmpl = array (
                    'table_open'          => '<table border="0" cellpadding="4" cellspacing="4">
					<thead><tr><th colspan="2">Update '.$user['MName'].'\'s account</th></tr></thead>',

                    'heading_row_start'   => '<tr>',
                    'heading_row_end'     => '</tr>',
                    'heading_cell_start'  => '<th>',
                    'heading_cell_end'    => '</th>',

                    'row_start'           => '<tr>',
                    'row_end'             => '</tr>',
                    'cell_start'          => '<td>',
                    'cell_end'            => '</td>',

                    'row_alt_start'       => '<tr>',
                    'row_alt_end'         => '</tr>',
                    'cell_alt_start'      => '<td>',
                    'cell_alt_end'        => '</td>',

                    'table_close'         => '<tfoot><tr><td>&nbsp;</td><td>&nbsp;</td></tfoot></table>'
              );

	$this->table->set_template($tmpl); 
	$group='<select name="MemberGroup" id="MemberGroup">'.$group.'</select>';
	
	$this->table->add_row('Username',form_input($username));
	$this->table->add_row('Password', form_password($password).' -<font size="-4"><em>Leave blank for no change</em> </font>');
	$this->table->add_row('Member Group', $group);
	$this->table->add_row('Email ID', form_input($email));
	$this->table->add_row('URL', form_input($murl));
	$this->table->add_row('First Name',form_input($firstname));
	$this->table->add_row('Last Name', form_input($lastname));
		$this->table->add_row('','<input type="submit" name="post"  class="small-button" value="Submit" />&nbsp;<input type="reset" name="Reset" class="small-button" id="button" value="Reset" />');
	

	echo $this->table->generate();
	
	
?></div>